<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <script src="../lib/vue2.js"></script>
  </head>
  <body>
    <div id="box">
      <!-- lazy修饰符，当失去焦点后同步数据 -->
      <input type="text" v-model.lazy="mytext1" />{{mytext1}}
      <!-- number修饰符，自动转化为number类型，一般与num输入框使用 -->
      <!-- 在有数字和其他字符时会屏蔽其他字符 -->
      <!-- 没有数字时不生效 -->
      <input type="number" v-model.number="mytext2" />{{mytext2}}
      <!-- trim修饰符，自动去除前后空格，中间空格保留一格 -->
      <input type="text" v-model.trim="mytext3" />{{mytext3}}
    </div>

    <script>
      let vm = new Vue({
        el: "#box",
        data: {
          mytext1: "",
          mytext2: "",
          mytext3: "",
        },
      });
    </script>
  </body>
</html>
